package sqlserver;

import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class ImpBugclose {
    public static void main(String[] args) throws Exception {
        Class.forName("net.sourceforge.jtds.jdbc.Driver");
        Connection tarConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://172.16.1.14:1433/RDSYSEDUV8", "sa", "Ep123!@#");
        try {
            DBInfo tarInfo = new DBInfo(tarConn, null, DBName.SqlServer2005);
            File excel = new File("/Users/firefly/Desktop/temp/bug-2.xls");
            Map<String,String> titleColumn = new HashMap<>();
            titleColumn.put("编号", "code");
            titleColumn.put("类型", "type");
            titleColumn.put("模块", "module");
            titleColumn.put("标题", "title");
            titleColumn.put("描述", "content");
            titleColumn.put("状态", "state");
            titleColumn.put("处理人", "procer");
            titleColumn.put("分配人", "setter");
            titleColumn.put("工作量", "times");
            titleColumn.put("环境", "environment");
            titleColumn.put("创建日期", "createDate");
            titleColumn.put("日志", "logs");
            DBUtils.impExcel2DB(tarInfo, excel, "T_BUGS", titleColumn);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally{
            tarConn.close();
        }
        
    }
}
